package io.renren.common.utils;

import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;

/**
 * @author zhengd
 */
public class RequestDataExtractor {

    /**
     * 获取请求头
     */
    public static String getHeader(HttpServletRequest request, String key) {
        Enumeration<String> list =  request.getHeaders(key);
        if (list == null || !list.hasMoreElements()) {
            return null;
        }
        return list.nextElement();
    }

    /**
     * 获得访问路径
     */
    public static String getPath(HttpServletRequest request) {
        return request.getServletPath();
    }

}